Chore: Fix test test_statement_with_error_trace#235
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
2a06e1c to
81d3309
Compare
| @@ -11,11 +11,8 @@ def test_statement_with_error_trace(cratedb_service): | |||
| engine = sa.create_engine(cratedb_service.database.dburi, connect_args={"error_trace": True}) | |||
| with engine.connect() as connection: | |||
| with pytest.raises(sa.exc.ProgrammingError) as ex: | |||
There was a problem hiding this comment.
pytest.raises has a match parameter that accepts regex
| with pytest.raises(sa.exc.ProgrammingError) as ex: | |
| with pytest.raises(sa.exc.ProgrammingError, match=re.escape('InvalidColumnNameException["_id" conflicts with system column]')) as ex: |
There was a problem hiding this comment.
Thank you, I didn't know that.
Here, I think I had intended to match both variants, now clarified by an inline comment. In this case, I think it is not comfortable to add them to pytest.raises(...)?
# Make sure both variants match, to validate it's actually an error trace.
assert ex.match(re.escape('InvalidColumnNameException["_id" conflicts with system column]'))
assert ex.match(
'io.crate.exceptions.InvalidColumnNameException: "_id" conflicts with system column'
)The test case validates the `error_trace` feature. However, the offending query became valid now, so it needed to be changed.
81d3309 to
f43c7f5
Compare
The test case validates the
error_tracefeature. However, the offending query became valid now, so it needed to be changed.